﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;

namespace PropertyAppraisal.SystemManage
{
    public partial class XiTongAddEmp : System.Web.UI.Page
    {
        private static UsersBll blll = new UsersBll();
        private static DepartmentBll bll = new DepartmentBll();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 绑定部门下拉框
        /// </summary>
        /// <returns></returns>
        public static string departmentBD()
        {
            List<SysDepartment> dept = bll.DepartmentBD();
            var HtmlStr = "";
            for (var i = 0; i < dept.Count; i++)
            {
                HtmlStr += "<option value=\"" + dept[i].department_Id + "\">" + dept[i].department_Name + "</option>";
            }
            return HtmlStr;
        }

        [WebMethod]
        public static bool AddEmp(string name, int sex, string card, string phone, string email, string account, int juese, int bumen)
        {
            
           
            SysUser user = new Model.SysUser();
            user.users_CreatePeople = HttpContext.Current.Session["UserName"].ToString();
            user.users_CreateTime = DateTime.Now;
            user.Department_Id =bumen;
            user.Roles_id = juese;
            user.users_Account = account;
            user.users_IsState = 0;
            user.users_Name = name;
            user.users_Pwd = "123";
            user.users_TEL = phone;
            if(blll.AddUser(user))
            {
                return true;
            }
            return false;
        }
    }
}